<extend name="Public/base"/>

<block name="body">
	<div class="main-title">
		<h2>留言管理 </h2>
	</div>

	<div class="data-table table-striped">
		<table>
			<thead>
				<tr>
					<th>ID</th>
					<th>姓名</th>
					<th>电话</th>
					<th>QQ</th>
					<th>微信号</th>
					<th>内容</th>
					<th>时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="list">
				<volist name="list" id="item">
					<tr>
						<td>{$item.id}</td>
						<td>{$item.name}</td>
						<td>{$item.tel}</td>
						<td>{$item.qq}</td>
						<td>{$item.weixin}</td>
						<td>{$item.content}</td>
						<td>{$item.create_time|date='Y-m-d H:i',###}</td>
						<td>
							<a title="查看" href="{:U('detail?id='.$item['id'])}">查看</a>
							<a title="查看" href="{:U('del?id='.$item['id'])}">删除</a>
						</td>
					</tr>
				</volist>
				<else/>
				<td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
			</tbody>
		</table>
		<!-- 分页 -->
	    <div class="page">
	        {$page}
	    </div>
	</div>
</block>

<block name="script">
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
	//点击排序
	$('.list_sort').click(function(){
		var url = $(this).attr('url');
		var ids = $('.ids:checked');
		var param = '';
		if(ids.length > 0){
			var str = new Array();
			ids.each(function(){
				str.push($(this).val());
			});
			param = str.join(',');
		}

		if(url != undefined && url != ''){
			window.location.href = url + '/ids/' + param;
		}
	});
});
</script>
</block>